import API from "./config"
export default {
  searchGoods (page, pageSize, goodsName, sortType, cateType, goodsCateId) {
    return API.post(`/goods/getGoodsListBySearch`, { page, pageSize, goodsName, sortType, cateType, goodsCateId })
  },
  goodsDetail (goodsId) {
    return API.post(`/goods/getGoodsDetail/${goodsId}`)
  },

  //推荐搭配
  recommendCollocation (goodsId) {
    return API.get(`/goods/getCollocationPackage/${goodsId}`)
  },
  // 记录次数
  recordNum (goodsId) {
    return API.post(`/goods/addGoodsBrowserLogAccessNum/${goodsId}`)
  },
  // 是否收藏
  getCollection (goodsId) {
    return API.get(`/goods/getGoodsIsCollection/${goodsId}`)
  },

  // 收藏
  collection (goodsId, isCollection) {
    return API.post(`/goods/setGoodsCollection/${goodsId}/${isCollection}`)
  },

  // 评价
  queryEvaluates (goodsId, page, pageSize, searchType) {
    return API.post(`/goods/getGoodsRateList`, { goodsId, page, pageSize, searchType })
  },

  queryEvaluateDetail (id) {
    return API.get(`/order/getOrderRateById/${id}`)
  },

  createEvaluate (ratecomtent, score, orderId, imgurls) {
    API.post(`/order/rate`, [{ ratecomtent, score, orderId, imgurls }])
  },

  // 获取sku
  querySku (goodsId) {
    return API.get(`/goods/getGoodsSkuList/${goodsId}`)
  },

  getGoodsUserCollectionList (page, pageSize) {
    return API.post(`/goods/getGoodsUserCollectionList`, { page, pageSize })
  },

  hotWord () {
    return API.get(`/goods/getKeywordsList`)
  },
  
  getQrCode (goodsId) {
    return API.get(`/goods/getGoodsQRCode/${goodsId}`)
  }
}